#include "mice.h"
#include "ui_mice.h"

mice::mice(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::mice)
{
    ui->setupUi(this);
    this->setGeometry(QRect(600,300,780,600));//设定窗体大小和起始坐标
}

void mice::paintEvent(QPaintEvent *event){
    QPainter painter(this);//画游戏背景
    painter.setPen(Qt::black);
    painter.setBrush(Qt::yellow);
    painter.drawRect(15,15,560,560);//外围
    painter.setPen(Qt::black);
    painter.setBrush(Qt::green);
    painter.drawRect(25,25,540,540);
    painter.drawPixmap(25,25,540,540,QPixmap(":/Images/Img/grass.png"));//内围
    QFont font4("Courier",40);
    painter.setFont(font4);
    painter.setPen(Qt::black);
    painter.setBrush(Qt::black);
    painter.drawText(220,150,"打地鼠");//设置了三种按钮的样子与标题
    QFont font5("Courier",24);
    painter.setFont(font5);
    painter.setPen(Qt::blue);
    painter.setBrush(Qt::blue);
    painter.drawText(590,130,"得分: 0");

}
mice::~mice()
{
    delete ui;
}

